package actions;

import game.constants.ReferenceAction;
import interfaces.ActionInterface;
import interfaces.impl.Action;
import objects.WorldObject;
import universe.Universe;

public class ActionUsePotion extends Action{

 	private WorldObject potion = null;
 	private Universe universe=null;
	

	@Override
	public boolean processActionChild(Universe world) {
		if(potion==null || source == null || target == null){
			return false;
		}
		System.out.println("EJECUTE la accion tomar pocion"); 
		universe.removeObject(potion);
		
		return true;
	}

	

	public WorldObject getPotion() {
		return potion;
	}

	public void setPotion(WorldObject potion) {
		this.potion = potion;
	}

	public void setUniverse(Universe universe) {
		this.universe=universe;
		
	}



	@Override
	public void initializeName() {
		name="Use Potion";
		
	}



	@Override
	public void initializeId() {
		this.id=ReferenceAction.ACTION_USE_POTION;
		
	}



	@Override
	public void modifyAction(ActionInterface action) {
		// TODO Auto-generated method stub
		
	}



	@Override
	public void modifyChild(ActionInterface action) {
		if (action instanceof ActionUsePotion) {
			ActionUsePotion ac = (ActionUsePotion) action;
			this.potion=ac.potion;
			this.universe=ac.universe;
		}
		
	}
	
	@Override
	public ActionUsePotion cloneAction(){
		ActionUsePotion action = new ActionUsePotion();
		action.modifyAction(this);
		return action;
		
	}
	

}
